﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace homework_windows窗体应用
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        
        int preNumber1 = 0;
        int preNumber2 = 0;
        string op = "";
        private void textBox1_TextChanged(object sender, EventArgs e)
        {
           preNumber1=Convert.ToInt32( textBox1.Text);
            
        }

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void label2_Click(object sender, EventArgs e)
        {

        }

        private void textBox2_TextChanged(object sender, EventArgs e)
        {
            preNumber2 = Convert.ToInt32(textBox2.Text);
           
        }
        
        private void label3_Click(object sender, EventArgs e)
        {

        }

        private void label4_Click(object sender, EventArgs e)
        {

        }
        private void textBox3_TextChanged(object sender, EventArgs e)
        {
            op = textBox3.Text;
           
        }
        int result;
        private void button14_Click(object sender, EventArgs e)
        {
            string d = button14.Text;
            switch(op){
                case "+":result = preNumber1 + preNumber2;break;
                case "-": result = preNumber1 - preNumber2; break;
                case "*": result = preNumber1 * preNumber2; break;
                case "/": result = preNumber1 / preNumber2; break;
                default:Console.WriteLine("fault");break;
            }
            textBox4.Text = Convert.ToString(result);
        }

      
    }
}
